home *** CD-ROM | disk | FTP | other *** search
- /* ------------------------------------------------------------------------- */
- /* ----- Have a nice time with Niceline ------------------------------------ */
- /* ------------------------------------------------------------------------- */
- /* ----------------------------------------- (c) 1992 by Oliver Scheel ----- */
- /* --------------------------------------------- Freaky Deaky Software ----- */
- /* ------------------------------------------------------------------------- */
-
- #include <portab.h>
- #ifdef STANDALONE
- #include <aes.h>
- #else
- #include <smallaes.h>
- #include <ltmf_str.h>
- #endif
- #include <vdi.h>
-
- /* ------------------------------------------------------------------------- */
-
- VOID save_regs _((VOID));
- VOID restore_regs _((VOID));
-
- #ifndef STANDALONE
- EXTERN LTMFLY letemfly;
- #endif
-
- /* ------------------------------------------------------------------------- */
-
- #ifdef STANDALONE
- CHAR *nclnwhat = { "@(#)Niceline Version 1.01 "__DATE__ };
- #endif
-
- /* ------------------------------------------------------------------------- */
-
- WORD nl_handle = 1;
-
- MLOCAL WORD STDARGS draw_line _((PARMBLK *p));
- MLOCAL WORD check_entry _((CHAR *s));
- MLOCAL WORD check_gfa _((OBJECT *tree));
-
- VOID STDARGS init_niceline _((OBJECT *tree));
- /*
- USERBLK niceline = { draw_line,
- 0l };
- */
- USERBLK niceline = { draw_line,
- (LONG)G_STRING };
-
- /* ------------------------------------------------------------------------- */
- /* ----- draw niceline ----------------------------------------------------- */
- /* ------------------------------------------------------------------------- */
-
- MLOCAL WORD STDARGS draw_line(p)
- PARMBLK *p;
- {
- WORD pxyarray[4];
- WORD attrib[5];
-
- /* save_regs();
- */ vql_attributes(nl_handle, attrib);
- vsl_type(nl_handle, 1);
- vsl_width(nl_handle, 1);
- vsl_color(nl_handle, BLACK);
- pxyarray[0] = p->pb_x;
- pxyarray[1] = pxyarray[3] = p->pb_y + p->pb_h/2 - 1;
- pxyarray[2] = p->pb_x + p->pb_w;
- vs_clip(nl_handle, 0, pxyarray);
- v_pline(nl_handle, 2, pxyarray);
- pxyarray[1]++;
- pxyarray[3]++;
- v_pline(nl_handle, 2, pxyarray);
-
- vsl_type(nl_handle, attrib[0]);
- vsl_width(nl_handle, attrib[3]);
- vsl_color(nl_handle, attrib[1]);
-
- /* restore_regs();
- */ return(p->pb_currstate);
- }
-
- /* ------------------------------------------------------------------------- */
- /* ----- check_entry ------------------------------------------------------- */
- /* ------------------------------------------------------------------------- */
-
- MLOCAL WORD check_entry(s)
- CHAR *s;
- {
- WORD flag;
-
- if(*s)
- {
- flag = 0;
- while((*s == '-') || (*s == '=') || (*s == ' '))
- {
- if(*s++ != ' ')
- flag = 1;
- }
- return(!*s && flag);
- }
- else
- return(0);
- }
-
- /* ------------------------------------------------------------------------- */
- /* ----- check_gfa --------------------------------------------------------- */
- /* ------------------------------------------------------------------------- */
-
- MLOCAL WORD check_gfa(tree)
- OBJECT *tree;
- {
- WORD i;
- WORD txt_cnt;
-
- txt_cnt = 0;
- i = 0;
- while((txt_cnt < 3) && !(tree[i].ob_flags & LASTOB))
- {
- if((tree[i].ob_type & 0xff) == G_STRING)
- txt_cnt++;
- i++;
- }
- return(tree[i-1].ob_spec.free_string[0] == ' ');
- }
-
- /* ------------------------------------------------------------------------- */
- /* ----- init niceline ----------------------------------------------------- */
- /* ------------------------------------------------------------------------- */
-
- VOID STDARGS init_niceline(tree)
- OBJECT *tree;
- {
- WORD obj;
- /* WORD d;
- */ OBJECT *tr;
-
- #ifndef STANDALONE
- if(!(letemfly.conf & C_NICELN))
- return;
- #endif
- /* nl_handle = graf_handle(&d, &d, &d, &d); */
- obj = 0;
- do
- {
- tr = &tree[obj];
- if((tr->ob_state & DISABLED)
- && ((tr->ob_type & 0xff) == G_STRING)
- && check_entry(tr->ob_spec.free_string))
- {
- tr->ob_type &= 0xff00;
- tr->ob_type |= G_USERDEF;
- tr->ob_spec.userblk = &niceline;
- }
- }
- while(!(tree[obj++].ob_flags & LASTOB));
- }
-
- /* ------------------------------------------------------------------------- */
- /* ----- menu_patch -------------------------------------------------------- */
- /* ------------------------------------------------------------------------- */
-
- VOID menu_patch(tree, showit)
- OBJECT *tree;
- WORD showit;
- {
- #ifndef STANDALONE
- if(!(letemfly.conf & C_NICELN))
- return;
- #endif
- if((showit == 1) && check_gfa(tree))
- {
- init_niceline(tree);
- }
- }
-